<template>
	<view style="width: 700upx;padding: 25upx;overflow:hidden;">
		<rich-text :nodes="agreement" style="word-break:break-all;white-space: pre-line;"></rich-text>
	</view>
</template>

<script>
	import url_config from '../../../common/config.js'
	export default {
		data() {
			return {
				nodes: [{
					name: 'div',
					attrs: {
						class: 'div-class',
						style: 'line-height: 60px; color: red; text-align:center;'
					},
					children: [{
						type: 'text',
						text: 'Hello&nbsp;uni-app!'
					}]
				}],
				agreement:''
			}
		},
		onLoad() {
			this.type_api()
		},
		methods: {
			type_api() {
				var that = this
				uni.request({
				    url: url_config.Url+'login/agreement', //仅为示例，并非真实接口地址。
				    data: {},
					method: 'POST',
				    header: {
				        'custom-header': 'hello' //自定义请求头信息
				    },
				    success: (res) => {
						var richtext=  res.data.data.text
						const regex = new RegExp('<img', 'gi');
						richtext= richtext.replace(regex, `<img style="max-width: 100%;"`);
						var fullContent = richtext.replace(/&nbsp;/g, '\xa0');
						this.agreement = fullContent
				    }
				});
			},
		}
	}
</script>

<style>
	page{
		/* padding-top: 30upx; */
	}
</style>
